import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    redirect: '/music',
  },
  {
    path: '/music',
    redirect: '/music/playlist',
    component: () => import('views/Music'),
    children: [
      {
        path: '/music/playlist',
        component: () => import('views/playlist'),
      },
      {
        path: '/music/search',
        component: () => import('views/search'),
      },
      {
        path: '/music/songlist',
        component: () => import('views/songlist'),
      },
      {
        path: '/music/playback',
        component: () => import('views/playback'),
      },
      {
        path: '/music/mv',
        component: () => import('views/mv'),
      },
      {
        path: '/music/details/:id',
        component: () => import('views/details'),
      },
    ],
  },
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
